//
//  ByViewLookDoctorSearch.m
//  jinpuyiyuan_ios
//
//  Created by pro on 2017/12/18.
//  Copyright © 2017年 mc. All rights reserved.
//

#import "ByViewLookDoctorSearch.h"

@interface ByViewLookDoctorSearch()<UITextFieldDelegate>
@end

@implementation ByViewLookDoctorSearch
{
    UIView          *_searchBgView;
    UITextField     *_searchTf;
    UIButton        *_searchButton;
    UIImageView     *_searchImg;
}
- (instancetype)init{
    if (self = [super init]) {
        [self createViews];
    }
    return self;
}

- (void)createViews{
    _searchButton = [[UIButton alloc] init];
    [self addSubview:_searchButton];
    CGFloat width = [@"搜索" getSizeOfString:14].width + 5;
    [_searchButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(@(-20));
        make.top.equalTo(@(10));
        make.size.mas_equalTo(CGSizeMake(width, 30));
    }];
    [_searchButton setTitle:@"搜索" forState:UIControlStateNormal];
    [_searchButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    _searchButton.titleLabel.font = FONT(14);
    
    _searchBgView  = [[UIView alloc] init];
    [self addSubview:_searchBgView];
    [_searchBgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(20));
        make.top.equalTo(@(10));
        make.right.equalTo(_searchButton.mas_left).offset(-5);
        make.bottom.equalTo(@(-10));
    }];
    _searchBgView.layer.cornerRadius = 30 / 2;
    _searchBgView.backgroundColor = [UIColor colorWithWhite:0.95 alpha:1];
    
    _searchImg = [[UIImageView alloc] init];
    [_searchBgView addSubview:_searchImg];
    [_searchImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(10));
        make.top.equalTo(@(5));
        make.size.mas_equalTo(CGSizeMake(20, 20));
    }];
    _searchImg.image = [UIImage imageNamed:@"Index_sousuo"];
    
    _searchTf = [[UITextField alloc] init];
    [_searchBgView addSubview:_searchTf];
    [_searchTf mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_searchImg.mas_right).offset(5);
        make.top.equalTo(@(5));
        make.right.equalTo(@(-10));
        make.bottom.equalTo(@(-5));
    }];
    _searchTf.placeholder = @"搜索医生";
    
//    [_searchButton addTarget:self action:@selector(searchAction) forControlEvents:UIControlEventTouchUpInside];
    
}

@end
